import 'package:flutter/material.dart';

void main() {
  // 1. 运行应用程序。
  runApp(const MaterialApp(home: Main()));
}

class Main extends StatelessWidget {
  const Main({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('滚动组件-ListView'),
        backgroundColor: Colors.white,
      ),
      body: Container(
        child: ListView(
          scrollDirection: Axis.vertical,
          //physics: NeverScrollableScrollPhysics(),
          reverse: true,
          children: [
            Container(
              height: 50,
              color: Colors.red,
              child: Text('子元素1'),
            ),
            Container(
              height: 100,
              color: Colors.green,
              child: Text('子元素2'),
            ),
            Container(
              height: 150,
              color: Colors.blue,
              child: Text('子元素3'),
            ),
            Container(
              height: 200,
              color: Colors.yellow,
              child: Text('子元素4'),
            ),
            Container(
              height: 150,
              color: Colors.purple,
              child: Text('子元素5'),
            ),
            Container(
              height: 100,
              color: Colors.pink,
              child: Text('子元素6'),
            ),
            Container(
              height: 50,
              color: Colors.orange,
              child: Text('子元素7'),
            ),
            Container(
              height: 50,
              color: Colors.brown,
              child: Text('子元素8'),
            ),
            Container(
              height: 50,
              color: Colors.cyan,
              child: Text('子元素9'),
            ),
            Container(
              height: 50,
              color: Colors.grey,
              child: Text('子元素10'),
            ),
            Container(
              height: 50,
              color: Colors.black,
              child: Text('子元素11'),
            ),
            Container(
              height: 50,
              color: Colors.lightBlue,
              child: Text('子元素12'),
            ),
          ],
        ),
      ),
    );
  }
}
